﻿function getObject(obj) {
    //alert(obj);
    return document.getElementById(obj);
}

function showObj(obj) {
    var objEl = document.getElementById(obj);
    //alert(objEl);
    objEl.style.display = "";
}

function CloseObj(obj) {
    var objEl = document.getElementById(obj);
    //alert(objEl);
    objEl.style.display = "none";
}
//edit by pfma 20100521
function changeObj(obj, count, index, bg1, bg2) {
    for (var i = 1; i <= count; i++) {
        if (i == index) {
            showObj(obj + i);
            document.getElementById(obj + i + "_t").style.background = bg1;
        } else {
            CloseObj(obj + i);
            document.getElementById(obj + i + "_t").style.background = bg2;
        }
    }
}

function shutwin() {
    window.close();
    return;
}

function menuFix() {
    var sfEls = document.getElementById("nav").getElementsByTagName("li");
    for (var i = 0; i < sfEls.length; i++) {
        sfEls[i].onmouseover = function () {
            this.className += (this.className.length > 0 ? " " : "") + "sfhover";
        }
        sfEls[i].onMouseDown = function () {
            this.className += (this.className.length > 0 ? " " : "") + "sfhover";
        }
        sfEls[i].onMouseUp = function () {
            this.className += (this.className.length > 0 ? " " : "") + "sfhover";
        }
        sfEls[i].onmouseout = function () {
            this.className = this.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
        }
    }
}

function goto_url(ua, ub) {
    var t = window.location.protocol;
    var f = window.location.host;
    if (f == "cnc.emoney.cn") {
        window.location.href = t + "//" + f + ub;
    }
    else {
        window.location.href = t + "//" + f + ua;
    }
}

String.prototype.LenB = function () {
    return this.replace(/[^\x00-\xff]/g, "**").length;
}

function validInt(e) {
    if (!isInt(e.value)) return false;
    else return true;
}
function isInt(s) {
    var patrn = /^[-,+]{0,1}[0-9]{0,}$/;
    if (!patrn.exec(s))
        return false;
    return true;
}
function isMobile(e) {
    //alert(typeof(e));
    var s = "";
    if (typeof (e) == "object") s = e.value;
    if (typeof (e) == "string") s = e;
    var patrn = /^1[3|5|8][0-9]\d{8}$/;
    if (!patrn.test(s)) return false;
    return true;
}

var $ = function (strid) {
    return (typeof (strid) == "object") ? strid : document.getElementById(strid);
};

function LoadVideoById(id, _obj) {
    var _objpp = _obj.parentNode.parentNode;
    var _arryli = _objpp.getElementsByTagName("li");
    for (i = 0; i < _arryli.length; i++) {
        if (_arryli[i].className == "playing") _arryli[i].className = "";
    }
    _obj.parentNode.className = "playing";
    Ajax_Service.LoadVideoById(id, function (_obj) {
        var result = _obj.value;
        document.getElementById("player").innerHTML = result.split("$")[0];
        document.getElementById("video_serise").innerHTML = result.split("$")[1];
    })
}

function LoadVideoByURL(_url, _obj) {
    if ($(_obj).className == "play_title") {
        var _arry = $("video_serise").getElementsByTagName("span");
        for (i = 0; i < _arry.length; i++) {
            if (_arry[i].className == 'current_title') _arry[i].className = "play_title";
        }
        $(_obj).className = "current_title";
    }
    Ajax_Service.LoadVideoByURL(_url, function (_obj) {
        document.getElementById("player").innerHTML = _obj.value;
    })
}



